/**
 * Created by Administrator on 2017/8/24.
 */
avalon.component('ms-header', {
    template: '<div class="header"><div class="topNav">\
	<ul>\
	<li><a href="#">爱迪尔商城</a></li>\
	<li><a href="../../page/index/index.html">关于爱迪尔</a></li>\
	<li><a href="">招商直通</a></li>\
	<li><a href="../../page/news/index.html">新闻中心</a></li>\
	<li><a href="../../page/serviceSupport/index.html">服务与支持</a></li>\
	<li><a href="../../page/recruitment/index.html">人才招聘</a></li>\
	<li><a href="#">香港HOH网站</a></li>\
	<li><a href="#">美国IDLK网站</a></li>\
	</ul>\
	</div>\
	<div class="navBar" ms-mouseenter="@callback" ms-mouseleave="@callback1">\
	<div class="navContent">\
	<div class="logo"></div>\
	<ul>\
	<li ms-for="（index,el) in @mainPush"><a href="javascript:;" ms-click="selectMainPro(index)" ms-html="el.name">家庭方案</a></li>\
	</ul>\
	<div class="search">\
	<input type="text" ms-duplex="@search" placeholder="请输入商品名">\
	<div ms-click="@searchPro()"></div>\
	</div>\
	</div>\
	<div ms-class="@dropDown"><ul>\
    <li ms-for="el in @mainPushList" ms-click="goDetail(el.id)">\
    <img ms-attr="{src : el.imagePath}| src" alt="">\
    <p ms-html="el.name">指纹智能锁</p>\
    </li>\
    </ul>\
    </div>\
	</div></div>',

    defaults: {
        search: '',
        mainPush: [],
        mainPushList: [],
        dropDown: 'hidden',
        callback: function () {
            this.dropDown = 'dropDown';
        },
        callback1: function () {
            this.dropDown = 'hidden';
        },
        searchPro: function () {
            var self = this;
            ff.util.submit({
                url: 'commodity/searchCommodity',
                data: {
                    title: self.search,
                    page: 1,
                    pageSize: 10
                },
                success: function (res) {
                    var search_data = res.resultData;
                    console.log(JSON.stringify(search_data, null, 4))
                    if (search_data.items.length > 0) {
                        var url = baseSearchUrl + 'product/productlist.html';
                        window.location.href = url + "?webType=websiteSearch&websearchName=" + self.search;
                    }
                }
            });
        },
        onReady: function () {
            console.log("onReady starts ...")
            var self = this;
            ff.util.submit({
                url: 'commodity/findMainPushClassifyAll',
                data: {},
                success: function (res) {
                    self.mainPush = res.resultData.items;
                    self.mainPushList = res.resultData.items[0].commodityEditList;
                    console.log(self.mainPush.length);
                }
            })
        },
        goDetail: function (id) {
            console.log("websiteId==="+id)
            var url = baseSearchUrl + "product/content.html";
            window.location.href = url + '?websiteId=' + id + "&webType=webType"
            /* var data = {
             'id': id,
             'type': type
             };
             var key = 'goodsId';*/
            // ff.page.go(url, data, key);
        },
        selectMainPro: function (index) {
            this.mainPushList = this.mainPush[index].commodityEditList;
        }
    }
})

avalon.component('ms-service', {
    template: '<div class="linkArea"><div class="service">\
	<div>\
	<img src="../../asset/images/wx_icon.png" alt="">\
	<p>上门安装</p>\
	</div>\
	<div>\
	<img src="../../asset/images/sh_icon.png" alt="">\
	<p>网点售后</p>\
	</div>\
	<div>\
	<img src="../../asset/images/sh_icon.png" alt="">\
	<p>质量保障</p>\
	</div>\
	<div>\
	<img src="../../asset/images/gz_icon.png" alt="">\
	<p>品牌价值</p>\
	</div>\
	<div>\
	<img src="../../asset/images/gz_icon.png" alt="">\
	<p>专业技术</p>\
	</div>\
	</div>\
	<div class="business">\
	<dl>\
	<dt>帮助中心</dt>\
	<dd><a href="#">账户管理</a></dd>\
	<dd><a href="../../page/index/serviceSupport/orderTracking.html">订单查询</a></dd>\
	<dd><a href="../../page/index/serviceSupport/securityCheck.html">防伪查询</a></dd>\
	</dl>\
	<dl>\
	<dt>服务支持</dt>\
	<dd><a href="../../page/index/serviceSupport/solution.html">站点分布</a></dd>\
	<dd><a href="../../page/index/serviceSupport/download.html">资料下载</a></dd>\
	<dd><a href="../../page/index/contactUs.html">联系方式</a></dd>\
	</dl>\
	<dl>\
	<dt>产品案例</dt>\
	<dd><a href="../../page/product/index.html">产品中心</a></dd>\
	<dd><a href="../../page/index/serviceSupport/caseCenter.html">案例中心</a></dd>\
	</dl>\
	<dl>\
	<dt>关于爱迪尔</dt>\
	<dd><a href="#">了解爱迪尔</a></dd>\
	<dd><a href="#">加载爱迪尔</a></dd>\
	</dl>\
	<dl>\
	<dt>关注我们</dt>\
	<dd><a href="#">新浪微博</a></dd>\
	<dd><a href="#">爱迪尔论坛</a></dd>\
	<dd><a href="#">官方微信</a></dd>\
	</dl>\
	<dl>\
	<dt>授权查询</dt>\
	<dd><a href="../../page/index/serviceSupport/agentInquiries.html">代理商查询</a></dd>\
	<dd><a href="../../page/index/serviceSupport/">网上授权查询</a></dd>\
	</dl>\
	<ul>\
	<li>0755-83930550</li>\
	<li>周一至周日 8:00-18:00</li>\
<li>（仅收市话费）</li>\
<li><span></span>24小时在线响应</li>\
</ul>\
</div></div>',
    default: {
        website: '',//官网地址
    }
})

avalon.component('ms-footer', {
    template: '<div class="footer"> <div> <p>Copyright © 1993-2017 ADEL Group All Rights Reserved    投诉电话:15818669806（以短信为主）工商营业执照注册号：440301103174719    国家信产部ICP经营许可证备案号：粤ICP备13017878</p> <img src="../../asset/images/gswj.png" alt=""> </div> </div>'
})
